<?php

namespace Mallocu\NuitInfoBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;

/**
 * Mallocu\NuitInfoBundle\Admin\MonumentAdmin
 * 
 * @author Rémi PIOTAIX <remi.piotaix@gmail.com>
 */
class MonumentAdmin extends Admin {

    protected function configureFormFields(FormMapper $formMapper) {
        $formMapper
                ->add('nom')
                ->add('dateCons')
                ->add('ville')
                ->add('departement')
                ->add('region')
                ->add('twitter')
                ->add('resume')
                ->add('description')
                ->add('types')
                ->add('images', 'sonata_type_collection', array(
                    'by_reference' => false
                ), array(
                    'edit' => 'inline',
                    'inline' => 'table'
                ))
        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper) {
        $datagridMapper
                ->add('nom')
        ;
    }

    protected function configureListFields(ListMapper $listMapper) {
        $listMapper
                ->addIdentifier('nom')
                ->add('dateCons')
                ->add('region')
        ;
    }

    public function validate(ErrorElement $errorElement, $object) {
//        $errorElement
//            ->with('name')
//                ->assertMaxLength(array('limit' => 32))
//            ->end()
//        ;
    }

}

?>
